<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="0"/>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
    <meta http-equiv="description" content="This is my page">
    <title>部门列表</title>
    <link rel="stylesheet" href="../styles/style.css" type="text/css"/>

    <!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
    <script>
        function addDept() {
            location.href = "http://localhost:8080/files/bumenadd.jsp";
        }
    </script>
    <script>
        function btn1(){
            var checkboxObj = document.getElementsByClassName("cks");
            var cks = [];
            for (var i = 0; i < checkboxObj.length; i++) {
                if (checkboxObj[i].checked == true) {
                    cks.push(checkboxObj[i].value)
                }
            }
            if (confirm("您确定要删除选中的条目吗?")) {
                location.href = "http://localhost:8080/delDeptsByids?ids="+cks;
            }
        }
    </script>
</head>

<body>
<div id="main_body">
    <!-- ----------用户结构start -------------------------->
    <ul class="main_top">
        <li class="main_top_left left">
            部门查询
            <BR>
        </li>
        <li class="main_top_right right"></li>
    </ul>
    <form name="form2" method="post" action="${pageContext.request.contextPath}/queryDept">
        <div class="main_content_rightbg">
            <div class="main_content_leftbg">
                <table width="80%" border="0" align=center cellpadding="2"
                       cellspacing="1" bgcolor="#FFFFFF" class="border">
                    <tr>
                        <td width="10%" align="right" nowrap class="tdbg">
                            <strong>部门名称：</strong>
                        </td>
                        <td colspan="3" width="30%" align="left" nowrap class="tdbg">
                            <input type="text" name="department_name">
                        </td>
                        <td width="20%" align="left" nowrap class="tdbg">
                            <input type="submit" value="查  询" class="newButton">
                        </td>
                    </tr>

                </table>
            </div>
        </div>
    </form>
    <ul class="main_end">
        <li class="main_end_left left"></li>
        <li class="main_end_right right"></li>
    </ul>
    <!-- ----------用户结构end -------------------------->


    <!--******************************************** -->
    <ul class="main_top">
        <li class="main_top_left left">
            部门列表
            <BR>
        </li>
        <li class="main_top_right right"></li>
    </ul>
    <div class="main_content_rightbg">
        <div class="main_content_leftbg">
            <form name="form1" method="post" action="../department_delAll">
                <table width="80%" border="0" align=center cellpadding="2"
                       cellspacing="1" bgcolor="#FFFFFF" class="border">
                    <tr>
                        <td width="5%" align="center" nowrap class="tdbg">
                            <strong>选择</strong>
                        </td>
                        <td align="center" class="tdbg">
                            <strong>部门名称</strong>
                        </td>
                        <td align="center" class="tdbg">
                            <div align="center">
                                <strong>部门电话</strong>
                            </div>
                        </td>
                        <td align="center" class="tdbg">
                            <div align="center">
                                <strong>部门传真</strong>
                            </div>
                        </td>
                        <td align="center" class="tdbg">
                            <div align="center">
                                <strong>所属部门(上级部门)</strong>
                            </div>
                        </td>
                        <td align="center" class="tdbg">
                            <div align="center">
                                <strong>部门职能</strong>
                            </div>
                        </td>
                        <td align="center" class="tdbg">
                            <div align="center">
                                <strong>部门编号</strong>
                            </div>
                        </td>
                        <td width="15%" align="center" nowrap class="tdbg">
                            <strong>操作</strong>
                        </td>

                    </tr>
                    <c:forEach items="${deptInfo.list}" var="d">
                        <tr>
                            <td align="center" class="tdbg">
                                <input type="checkbox"   name="checkbox" value="${d.id}" class="cks"/>
                            </td>
                            <td align="center" class="tdbg">
                                ${d.department_name}
                            </td>
                            <td align="center" class="tdbg">
                                ${d.department_phone}
                            </td>
                            <td align="center" class="tdbg">
                                ${d.department_fax}
                            </td>
                            <td align="center" class="tdbg">
                                ${d.department_parent}
                            </td>
                            <td align="center" class="tdbg">
                                ${d.department_remark}
                            </td>
                            <td align="center" class="tdbg">
                                    ${d.department_no}
                            </td>
                            <td align="center" class="tdbg">
                                <a href="${pageContext.request.contextPath}/findDeptById?id=${d.id}">修改</a>&nbsp;&nbsp;&nbsp;
                                <a href="${pageContext.request.contextPath}/delDeptById?id=${d.id}">删除</a>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
                <table width="80%" border="0" align=center cellpadding="0"
                       cellspacing="0" bgcolor="#FFFFFF">
                    <tr>
                        <td width="10%" align="left" class="tdbg">
                            <input id="chkAll" type="checkbox" value="checkbox"
                                   name="chkAll">
                            全选
                        </td>
                        <td width="70%" align="left" class="tdbg">
                            <STRONG>操作：</STRONG>
                            <input type="button"  onclick="btn1()" class="newButton" value="删除选定">
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="button" name="addButton" onclick='addDept()'class="newButton" value="添&nbsp;&nbsp;&nbsp;&nbsp;加">
                        </td>
                    </tr>
                </table>
            </form>
            <table width="80%" border="0" align=center cellpadding="2"
                   cellspacing="0" bgcolor="#FFFFFF" class="border">
                <tr>
                    <td height="40" align="center" class="tdbg">
                        <p>
                            当前第${deptInfo.pageNum}页，总${deptInfo.pages}页,总${deptInfo.total}条记录
                        </p>
                        <a href="bumenguanli?pageNo=${deptInfo.navigateFirstPage}">首页</a>
                        <c:if test="${t_deptInfo.hasPreviousPage }">
                            <a href="bumenguanli?pageNo=${deptInfo.pageNum-1}">上一页</a>
                        </c:if>
                        <c:forEach begin="1" end="${deptInfo.pages}" var="i">
                            <a href="bumenguanli?pageNo=${i}">${i}</a>
                        </c:forEach>
                        <c:if test="${deptInfo.hasNextPage }">
                            <a href="bumenguanli?pageNo=${deptInfo.pageNum+1}">下一页</a>
                        </c:if>

                        <a href="${pageContext.request.contextPath}/bumenguanli?pageNo=${deptInfo.navigateLastPage}">尾页</a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <ul class="main_end">
        <li class="main_end_left left"></li>
        <li class="main_end_right right">
            &quot;
        </li>
    </ul>
</div>
<br>
</body>
</html>
